{{!

  Copyright (c) Meta Platforms, Inc. and affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

}}{{!
    Import enums into the modules that reference enums.
}}
{{!
    from module_path.thrift_enums import *

These are referenced in the generated pyi files and, for simplicity,
need to be imported through the types modules.
}}
{{#program:enums}}
{{#first?}}

from {{program:module_path}}.thrift_enums import (
{{/first?}}
{{#program:is_source_file?}}
    {{enum:name}},
{{/program:is_source_file?}}
    {{enum:name}} as {{> private/alias_prefix}}{{enum:name}},
{{#last?}}
)
{{/last?}}
{{/program:enums}}
{{!
    with

    from module.path.thrift_enums import EnumName

    type-check at the point of use of EnumName fails with

    Undefined import [21]: Could not find a name `EnumName` defined in module `module.path.thrift_types`

    With the assignment below, teach the type-checker what EnumName is.
}}
{{#program:is_type_stub?}}
{{#program:enums}}
{{enum:name}} = {{> private/alias_prefix}}{{enum:name}}
{{/program:enums}}
{{/program:is_type_stub?}}
